home *** CD-ROM | disk | FTP | other *** search
/ Univers Interactif 3 / INTERACTIF.BIN / pc / planeten / internet / intersli.pin / InterSLIP Docs.rsrc / TEXT_132.txt < prev    next >
Text File  |  1993-09-15  |  8KB  |  299 lines

  1. Scripting
  2.  
  3. Dialing Scripts
  4.  
  5. InterSLIP includes a script interpreter compatible with the one used by AppleTalk Remote Access (ARA), with a few extensions. You can use ARA dialing scripts with InterSLIP, although they turn off any compression in the modem. This results in the fastest response time for interactive traffic but may not result in the greatest overall transfer rate for applications such as FTP or Gopher. 
  6.  
  7. To use an ARA dialing script:
  8.  
  9. 1. Place a copy of the ARA dialing script in the Dialing Scripts subfolder of the InterSLIP Folder.
  10.  
  11.  
  12. Connection Control Language (CCL) Quick Reference
  13.  
  14. This section provides a quick overview of CCL.  For detailed information, consult the AppleTalk Remote Access Modem Developer's Guide.
  15.  
  16. A script in CCL is a text file consisting of a series of statements, one to a line.  There are three kinds of statement: comments, labels, and commands.
  17.  
  18. A comment begins with an exclamation mark (!) and continues until the end of the line.  Comments are ignored by InterSLIP.
  19.  
  20. A label begins with an at sign (@) and continues until the end of the line.  A label denotes a point in the script that can be the target of a jump from another part of the script.  There are two kinds of labels:
  21.  
  22.     Symbolic labels: @ followed by a word
  23.     Numeric labels:  @label followed by a number
  24.  
  25. A command starts with a word (the command name) and is followed by arguments on the rest of the line.
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. Configuration Parameters
  37.  
  38. Each script has a set of ten configuration parameters that can be used by the script and substituted into other strings with the notation ^n, where n is a digit from 0 to 9.  The parameters are set up as follows:
  39.  
  40.     0    The text from the input stream that triggered the most recent match
  41.     1    The phone number to dial
  42.     2    0 if the speaker should be off while dialing, 1 if it should be on
  43.     3    T if tone dialing, P if pulse
  44.     4    The modem initialization string specified in InterSLIP Setup
  45.     5    The gateway user name
  46.     6    The gateway password
  47.     7    The IP address specified in InterSLIP Setup, if any
  48.     8    Y if RFC 1144 header compression has been specified in InterSLIP Setup
  49.     9    The MTU size specified in InterSLIP Setup
  50.  
  51.  
  52. Command Descriptions
  53.  
  54. Serial Port Control
  55.  
  56. DTRset
  57.             Asserts Data Terminal Ready.
  58.  
  59. DTRclear
  60.             Negates Data Terminal Ready.
  61.  
  62. SBreak
  63.             Sends a break.
  64.  
  65. SerReset speed, parity, databits, stopbits
  66.             Sets the speed and data format.  Parity can be 0 for no parity, 1 for odd parity,    and 2
  67.             for even parity.
  68.  
  69. SetSpeed speed
  70.             Sets the speed.
  71.  
  72. Write string
  73.             Sends the context of the string out the serial port.
  74.  
  75. CommunicatingAt speed
  76.             Sets the logical speed of communication, even if the serial port is locked to a higher
  77.             speed.
  78.  
  79.  
  80. HSReset f1 f2 f3 f4 f5 f6
  81.         Sets the handshaking mode; generally, all arguments are zero except for f2,
  82.         which turns on hardware handshaking if set to 1.
  83.  
  84.  
  85. Flow of Control within the Script
  86.  
  87. Jump label
  88.         Jumps to the specified label, which can be a number or the name of a symbolic label.
  89.  
  90. Pause n
  91.         Pauses for n 60ths of a second.
  92.  
  93. Exit code
  94.         Exits the script.  An exit code of 0 denotes success; any nonzero numeric value
  95.         denotes failure.
  96.  
  97. IfAnswer label
  98.         If the script is executing in answer mode (currently not used by InterSLIP), jump to
  99.         the specified label.
  100.  
  101. IfOriginate label
  102.         If the script is executing in originate mode, jump to the specified label.
  103.  
  104. IfHangup label
  105.         If the script is executing in hangup mode, jump to the specified label.
  106.  
  107. IfStr n label string
  108.         If configuration parameter n is equal to the string, jump to the specified label.
  109.  
  110.  
  111. Iteration
  112.  
  113. SetTries n
  114.         Sets the current "try" counter to n.
  115.  
  116. IncTries
  117.         Increments the "try" counter by 1.
  118.  
  119. DecTries
  120.         Decrements the "try" counter by 1.
  121.  
  122. IfTries n label
  123.         If the current try counter is equal to n, jump to the specified label.
  124.  
  125.  
  126. User Notification
  127.  
  128. Note string
  129.         Displays the string as a status message (if InterSLIP Setup is running).
  130.  
  131. Sound
  132.         Plays the current system beep.
  133.  
  134. Sound name
  135.         Plays the sound resource with the specified name.
  136.  
  137. UserHook n
  138.         Ignored (included for compatibility with AppleTalk Remote Access scripts).
  139.  
  140. Ask n string
  141.     Prompts the user for a response, which can then be referred to by the script
  142.     with the notation ^* in a manner similar to configuration parameters.  Since the
  143.     prompt itself can contain configuration parameters, including the results of
  144.     a MatchExp command (see below), this command can be useful in scripts which
  145.     involve challenge/response authentication systems and the like.  If n is 1, the
  146.     response is replaced by bullet characters ('ΓÇó'); if n is 0, the response is
  147.     displayed normally.
  148.  
  149.  
  150. Pattern Matching
  151.  
  152. MatchRead n
  153.         Wait for n ticks (60ths of a second), watching the incoming data for anything that
  154.         matches a currently active pattern buffer.  If a match is found, jump to the associated
  155.         label.
  156.  
  157. MatchClr
  158.         Clears the pattern buffers.
  159.  
  160. MatchStr n label pattern
  161.         Sets pattern buffer n to the specified pattern (a literal string) associated with
  162.         the specified label.
  163.  
  164. MatchExp n label pattern
  165.         Sets pattern buffer n to the specified pattern (a Unix-style regular expression)
  166.         associated with the specified label.  When a match occurs, the actual data that
  167.         matched the expression can be found in configuration parameter 0.
  168.  
  169.  
  170. IP Parameters
  171.  
  172. SetIP string
  173.         Sets the IP address to the contents of the string.  This is most useful when a regular
  174.         expression pattern has found a match and you want to retrieve the data with something
  175.         similar to SetIP "^0"
  176.  
  177. SetMTU string
  178.         Sets the current MTU size to the contents of the string.
  179.  
  180.  
  181. Gateway Scripts
  182.  
  183. Gateway scripts use the same CCL language as dialing scripts. 
  184.  
  185. To install a gateway script:
  186.  
  187. 1. Place a copy in the Gateway Scripts Folder inside of the InterSLIP Folder. The 
  188.         gateway name appears in the Gateway pop-up menu in the InterSLIP Configuration 
  189.         dialog.
  190.  
  191.  
  192. Sample Gateway Script
  193.  
  194. The following gateway script logs in to a CiscoΓäó terminal server and picks up an IP address assigned by the server for that particular session.
  195.  
  196.  
  197. !
  198. ! InterSLIP gateway script for Cisco terminal server
  199. !
  200. ! Label 99 is the general purpose error handler, which beeps
  201. ! and pauses long enough for the user to read the message.
  202. !
  203. ! First, we wait for the user name prompt
  204. !
  205. @originate
  206. note "Waiting for prompt"
  207. matchclr
  208. matchstr 1 1 "Username: "
  209. matchread 50
  210. note "No username prompt"
  211. jump 99
  212. !
  213. ! Now, send the user name and wait for the password prompt
  214. !
  215. @label 1
  216. note "Sending user name"
  217. write "^5\13"
  218. matchclr
  219. matchstr 1 2 "Password:"
  220. matchread 50
  221. note "No password prompt"
  222. jump 99
  223. !
  224. ! Send the password and wait for either the terminal server
  225. ! prompt or an error message
  226. !
  227. @label 2
  228. note "Sending password"
  229. write "^6\13"
  230. matchclr
  231. matchstr 1 4 ">"
  232. matchstr 2 3 "Access denied"
  233. matchread 120
  234. jump 99
  235. !
  236. ! If we got an error message, notify the user and fail
  237. !
  238. @label 3
  239. note "Access Denied"
  240. !
  241. ! General purpose error handler.  Let the message appear,
  242. ! beep, and then pause for a second.
  243. !
  244. @label 99
  245. pause 1
  246. sound
  247. pause 60
  248. exit -1
  249. !
  250. ! If we've successfully logged in, ask for SLIP mode and
  251. ! wait for the response.  If we get anything except
  252. ! "Entering SLIP mode.", assume something went wrong, and fail.
  253. !
  254. @label 4
  255. note "Requesting SLIP"
  256. write "slip\13"
  257. matchclr
  258. matchstr 1 5 "Entering SLIP mode."
  259. matchread 120
  260. note "Cannot invoke SLIP mode"
  261. jump 99
  262. !
  263. ! We've entered SLIP mode, so match on the first thing that
  264. ! looks like an IP address.  If we don't find one, fail.
  265. !
  266. @label 5
  267. matchclr
  268. matchexp 1 6 "[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*\\."
  269. matchread 120
  270. note "No IP address given"
  271. jump 99
  272. !
  273. ! We've found an IP address, so inform MacTCP of it, and
  274. ! watch for a number (the MTU size).
  275. !
  276. @label 6
  277. setip "^0"
  278. matchclr
  279. matchexp 1 7 "[0-9][0-9]*"
  280. matchread 120
  281. note "No MTU value"
  282. jump 99
  283. !
  284. ! We found the MTU size, so inform MacTCP and exit
  285. ! the script successfully.
  286. !
  287. @label 7
  288. setmtu "^0"
  289. exit 0
  290. !
  291. ! Answer and Hangup modes are currently unused in gateway
  292. ! scripts, but just for future compatibility, exit successfully.
  293. !
  294. @answer
  295. @hangup
  296. exit 0
  297.  
  298.  
  299.